-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ternary operation in stockflow macro syntax #135
Conversation
Probably wanna try actually running the differential equations on one of these. If you have an example which uses an if else in another software, try porting it. |
The changes look good to me, notwithstanding the current failing notebooks validation. We should probably make sure the docstrings at https://github.com/AlgebraicJulia/StockFlow.jl/pull/135/files#diff-4e1b9ec77867b43e29dfce6850ad2d9cab1373bef6eed4a38ac4b5c29f94c2a7L5 and https://github.com/AlgebraicJulia/StockFlow.jl/pull/135/files#diff-4e1b9ec77867b43e29dfce6850ad2d9cab1373bef6eed4a38ac4b5c29f94c2a7L116 are kept up-to-date (I.e., the module-level docstring and the docstring on the |
@Saityi I did a few changes so || and && can be used as well. Just convert A || B to or(A, B) := A || B and A && B to and(A,B) := A && B |
...Which is stupid, because || and && only allow bools. I guess we do: ...Eh, guess we don't need that outer int wrap |
...No, no, it might still work, since A < B should return a bool |
Allows use of the syntax A = B ? C : D in a dynamic variable, where B, C and D can be symbols or expressions. An expression of this form is converted into a function call cond(B,C,D) = B ? C : D